<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">微信支付服务商设置</div>
                            </div>
							<div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">
                                    服务商应用 <span class="tpl-form-line-small-title"> APP_ID </span>
                                </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="data[app_id]"
									value="{$model['app_id']}" required>
									<small>微信支付服务商关联公众号的APP_ID</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">
                                    服务商账号 <span class="tpl-form-line-small-title">MCH_ID</span>
                                </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="data[mch_id]"
									value="{$model['mch_id']}" required>
									<small>我还没有 <a href="https://mp.weixin.qq.com/"  target="_blank">登录公众号去申请</a> 。(支付服务商只能通过公众号申请开通)</small> 
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">
                                    API密钥 <span class="tpl-form-line-small-title">APIv3</span>
                                </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="data[api_key]"
									value="{$model['api_key']}" required>
									<small>必须是32位的数字和字符组合</small>
                                </div>
                            </div>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">API证书</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">
                                    证书 <span class="tpl-form-line-small-title">序列号</span>
                                </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="data[api_serial_no]"
									value="{$model['api_serial_no']}" required>
                                </div>
                            </div>
							<div class="am-form-group am-padding-top">
								<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">
                                    公钥 <span class="tpl-form-line-small-title">apiclient_cert.pem</span>
                                </label>
								<div class="am-u-sm-9 am-u-end">
									 <textarea rows="6" name="data[cert_pem]">{$model['cert_pem']}</textarea>
									<small>退款功能必填：使用文本编辑器打开apiclient_cert.pem文件，将文件的全部内容复制进来</small>
								</div>
							</div>
							<div class="am-form-group">
								<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">
                                    私钥 <span class="tpl-form-line-small-title">apiclient_key.pem</span>
                                </label>
								<div class="am-u-sm-9 am-u-end">
									 <textarea rows="6" name="data[key_pem]">{$model['key_pem']}</textarea>
									<small>退款功能必填：使用文本编辑器打开apiclient_key.pem文件，将文件的全部内容复制进来</small>
								</div>
							</div>
							<input type="hidden" name="data[serial_no]" value="{$model['serial_no']}">
							<input type="hidden" name="data[certificates]" value="{$model['certificates']}">
							<input type="hidden" name="data[expire_time]" value="{$model['expire_time']}">
							{if !empty($model['serial_no'])}
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">平台证书</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">
                                    证书 <span class="tpl-form-line-small-title">序列号</span>
                                </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" value="{$model['serial_no']}" disabled>
                                </div>
                            </div>
							<div class="am-form-group am-padding-top">
								<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">
                                    证书 <span class="tpl-form-line-small-title">报文</span>
                                </label>
								<div class="am-u-sm-9 am-u-end">
									 <textarea rows="6" disabled>{$model['certificates']}</textarea>
									<small>到期时间：{$model['expire_time']|date='Y-m-d'}，到期后会自动更新</small>
								</div>
							</div>
							{/if}
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {

        $('#my-form').formPost();

    });
</script>
